kmpkg_from_gitee(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO kumo-hub/srpc
    REF v${VERSION}
    SHA512 b07dec28ce106242e3e22a5f8050c498f462f0680e239d1acfcac4a9cd4eec02228584da7b12a1f060e0244b7988009189bf10b0caf7d0c7c9eccde0d7f8adb9
    HEAD_REF master
    PATCHES
        protobuf.patch
)

string(COMPARE EQUAL "${KMPKG_CRT_LINKAGE}" "static" SRPC_BUILD_STATIC_RUNTIME)

kmpkg_cmake_configure(
    SOURCE_PATH ${SOURCE_PATH}
    DISABLE_PARALLEL_CONFIGURE
    OPTIONS
        -DSRPC_BUILD_STATIC_RUNTIME=${SRPC_BUILD_STATIC_RUNTIME}
        -DCMAKE_CXX_STANDARD=11
    MAYBE_UNUSED_VARIABLES
        SRPC_BUILD_STATIC_RUNTIME
)

kmpkg_cmake_install()
kmpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/srpc)
kmpkg_copy_pdbs()
kmpkg_copy_tools(
    TOOL_NAMES srpc_generator
    AUTO_CLEAN
)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
kmpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
